package com.zl.autocode.common.constant;

import com.zl.common.enums.code.GlobalDictEnum;
import com.zl.common.enums.code.IDictEnum;

/**
 * 
 * @author zhouliang
 *
 */
public class ZlTemplateEnum extends GlobalDictEnum {
    
    /** 模板输出类型*/
    public enum OUTPUT_TYPE implements IDictEnum{
        
        OT1("1", "模块"),
        OT2("2", "方法"),
        OT3("3", "方法-对象"),
        OT4("4", "表"),
        OT5("5", "表-接口"),
        OT6("6", "方法-子对象"),
        OT99("99", "忽略"),
        
        ;
        private String code;
        private String msg;

        OUTPUT_TYPE(String code, String msg) {
            this.code = code;
            this.msg = msg;
        }
        @Override
        public String getCode() {
            return code;
        }
        @Override
        public String getMsg() {
            return msg;
        }
        
        public static String msg(String code) {
            for (OUTPUT_TYPE m : OUTPUT_TYPE.values()) {
                if (m.getCode().equalsIgnoreCase(code)) {
                    return m.getMsg();
                }
            }
            return null;
        }
    }
    
    public static boolean checkOutputTypeIsTable(String code) {
        return ZlTemplateEnum.OUTPUT_TYPE.OT4.getCode().equals(code)
                || ZlTemplateEnum.OUTPUT_TYPE.OT5.getCode().equals(code);
    }
}
